package com.ly.web.controller.erp;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ly.common.annotation.Log;
import com.ly.common.core.controller.BaseController;
import com.ly.common.core.domain.AjaxResult;
import com.ly.common.enums.BusinessType;
import com.ly.heart.domain.PlanCollectingNodeEntity;
import com.ly.heart.service.IPlanCollectingNodeEntityService;
import com.ly.common.utils.poi.ExcelUtil;
import com.ly.common.core.page.TableDataInfo;

/**
 * 计划回款时间节点，关联回款计划Controller
 *
 * @author cxl
 * @date 2024-05-14
 */
@Api(value = "PlanCollectingNode", tags = "计划回款时间节点，关联回款计划")
@RestController
@RequestMapping("/heart/PlanCollectingNode")
public class PlanCollectingNodeEntityController extends BaseController
{
    @Autowired
    private IPlanCollectingNodeEntityService planCollectingNodeEntityService;

    /**
     * 查询计划回款时间节点，关联回款计划列表
     */
    @PreAuthorize("@ss.hasPermi('heart:PlanCollectingNode:list')")
    @GetMapping("/list")
    @ApiOperation("查询计划回款时间节点")
    public TableDataInfo list(PlanCollectingNodeEntity planCollectingNodeEntity)
    {
        startPage();
        List<PlanCollectingNodeEntity> list = planCollectingNodeEntityService.selectPlanCollectingNodeEntityList(planCollectingNodeEntity);
        return getDataTable(list);
    }

    /**
     * 导出计划回款时间节点，关联回款计划列表
     */
    @PreAuthorize("@ss.hasPermi('heart:PlanCollectingNode:export')")
    @Log(title = "计划回款时间节点，关联回款计划", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出计划回款时间节点")
    public void export(HttpServletResponse response, PlanCollectingNodeEntity planCollectingNodeEntity)
    {
        List<PlanCollectingNodeEntity> list = planCollectingNodeEntityService.selectPlanCollectingNodeEntityList(planCollectingNodeEntity);
        ExcelUtil<PlanCollectingNodeEntity> util = new ExcelUtil<PlanCollectingNodeEntity>(PlanCollectingNodeEntity.class);
        util.exportExcel(list, "计划回款时间节点，关联回款计划数据");
    }

    /**
     * 获取计划回款时间节点，关联回款计划详细信息
     */
    @PreAuthorize("@ss.hasPermi('heart:PlanCollectingNode:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取计划回款时间节点")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(planCollectingNodeEntityService.selectPlanCollectingNodeEntityById(id));
    }

    /**
     * 新增计划回款时间节点，关联回款计划
     */
    @PreAuthorize("@ss.hasPermi('heart:PlanCollectingNode:add')")
    @Log(title = "计划回款时间节点，关联回款计划", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增计划回款时间节点")
    public AjaxResult add(@RequestBody PlanCollectingNodeEntity planCollectingNodeEntity)
    {
        return toAjax(planCollectingNodeEntityService.insertPlanCollectingNodeEntity(planCollectingNodeEntity));
    }

    /**
     * 修改计划回款时间节点，关联回款计划
     */
    @PreAuthorize("@ss.hasPermi('heart:PlanCollectingNode:edit')")
    @Log(title = "计划回款时间节点，关联回款计划", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改计划回款时间节点")
    public AjaxResult edit(@RequestBody PlanCollectingNodeEntity planCollectingNodeEntity)
    {
        return toAjax(planCollectingNodeEntityService.updatePlanCollectingNodeEntity(planCollectingNodeEntity));
    }

    /**
     * 删除计划回款时间节点，关联回款计划
     */
    @PreAuthorize("@ss.hasPermi('heart:PlanCollectingNode:remove')")
    @Log(title = "计划回款时间节点，关联回款计划", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation("删除计划回款时间节点")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(planCollectingNodeEntityService.deletePlanCollectingNodeEntityByIds(ids));
    }
}
